/**
 * Created with IntelliJ IDEA.
 * Description:
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2023-05-26  20:51
 */
public class Computer {
    public void powerOn() {
        System.out.println("打开笔记本！");
    }
    public void powerOff() {
        System.out.println("关闭笔记本！");
    }
    public void useDevice(USB usb) {
        usb.openDevice();
        if(usb instanceof Mouse) {
            Mouse mouse = (Mouse) usb;
            mouse.click();
        } else if (usb instanceof KeyBoard) {
            KeyBoard keyBoard = (KeyBoard) usb;
            ((KeyBoard) usb).inPut();
        }
        usb.closeDevice();
    }

}
